home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Suzy B Software 2
/
Suzy B Software CD-ROM 2 (1994).iso
/
mintprgs
/
mintupgr
/
disk8.zoo
/
ash.zoo
/
usr
/
doc
/
ash
/
dump
< prev
next >
Wrap
Text File
|
1992-05-04
|
3KB
|
88 lines
#!/bin/sh
# make incremental dump of filesystems
# usage: dump level filesystem...
#
# Dumps are made on $dumpdev, which contains a directory for every filesystem
# dumped. Of course, you cannot dump that filesystem itself. For example,
# if dumpdev=/dev/g, there will be the following directories:
# /dev/g/c
# /dev/g/d
# et cetera. Each such directory contains a file named YYYYMMDD.tar, where
# YYYYMMDD is the date of the dump. If you dump /dev/c on 03 May, 1992,
# there will be a file /dev/g/c/19920503.tar
version="0.0 alpha"
PATH=${root}/bin:${root}/usr/bin
set -e
# set -x # Uncomment this line when debugging
umask 022
dumpdev=/dev/g
root=u:
datesfile=${root}/etc/dumpdate
infofile=${root}/etc/dumpinfo
fatalerror () {
echo Dump aborted on `ddate` due to a signal >> $infofile
}
# Print message on fatal signal
trap fatalerror 2 3 4 5 6 7 8 10 11 12 13 15
echo Dump script version $version, Stephan Neuhaus for MiNT/TOS
program=$0
level=$1 ; shift
if test ! -d $dumpdev -a ! -b $dumpdev ; then
echo program: Dump device $dumpdev: not a directory nor block special file
exit 1
fi
for dumpdir in $* ; do
filesystem=/dev/${dumpdir}
if test ! -d $filesystem -a ! -b $filesystem ; then
echo $program: Source $filesystem: not a directory nor block special file
exit 1
fi
if test $level != 0 ; then
lastdate=`gawk '
BEGIN { found = 0 }
$1 == level - 1 && $6 == filesystem { lastdate=$4; lasttime=$5; found=1 }
END { if (found) printf "%s %s", lastdate, lasttime; }' \
level=${level} filesystem=${filesystem} ${datesfile}`
if test "x${lastdate}" -eq x ; then
echo Previous dump not found in ${datesfile}
exit 1
fi
fi
startdate=`ddate`
dumpdate=`echo $startdate | cut --delimiter=' ' --fields=1 | gawk -F / '{printf "%s%s%s", $3, $1, $2}'`
echo Begin of dump info for level $level dump of $filesystem >> $infofile
echo Level $level dump of $filesystem started on $startdate >> $infofile
echo -n Dumping $filesystem...
dumpfile=${dumpdev}/${dumpdir}/${dumpdate}.tar
if test ! -d ${dumpdev}/${dumpdir} ; then
mkdir ${dumpdev}/${dumpdir}
fi
cd $filesystem
if test $level == 0 ; then
tar +create +file $dumpfile .
else
tar +create +newer "$lastdate" +file $dumpfile .
fi
enddate=`ddate`
echo $level $startdate $enddate $filesystem >> ${datesfile}
echo -n Writing filelist...
echo List of files follows: >> $infofile
tar +list +verbose +file $dumpfile >> $infofile
echo Level $level dump of $filesystem ended on $enddate \(written on ${dumpfile}\) >> $infofile
ls -l $dumpfile >> $infofile
echo -n Compressing...
compress -f $dumpfile
cfile=`echo $dumpfile | sed s/tar/taz/g`
ls -l $cfile >> $infofile
echo End of dump info for level $level dump of $filesystem >> $infofile
echo Done.
done
echo Done.